<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>100-克隆节点.html</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		.box{
			width: 100px;
			height: 100px;
			background-color: red;
		}
	</style>
</head>
<body>
	<input type="button" id="btn1" value="cloneNode()">
	<input type="button" id="btn2" value="cloneNode(true)">
	<duv id="box" class="box">
		box
	</duv>
</body>
<script>
	var oBtn1 = document.getElementById('btn1');
	var oBtn2 = document.getElementById('btn2');
	var oBox = document.getElementById('box');

	oBtn1.onclick = function(){
		var newBox = oBox.cloneNode(false);
		document.body.appendChild(newBox);
	}
	oBtn2.onclick = function(){
		var newBox = oBox.cloneNode(true);
		document.body.appendChild(newBox);
	}
</script>
</html>